//
//  BGBaseDataAccesser.m
//  Kiwi
//
//  Created by CC on 2018/4/5.
//

#import "BGBaseDataAccesser.h"

@interface BGBaseDataAccesser();

@end

@implementation BGBaseDataAccesser

- (instancetype)init
{
    self = [super init];
    if (self) {
        self.manager = [BGDBManager sharedManager];
    }
    return self;
}

- (BOOL)insertObject:(id)obj {
    return [self.manager insertObject:obj];
}

- (BOOL)deleteWithClass:(Class)clz condition:(NSString *)condition, ... {
    va_list args;
    va_start(args, condition);
    BOOL result = [self.manager deleteWithClass:clz condition:condition value:args];
    va_end(args);
    return result;
}

- (BOOL)updateWithItem:(id)obj {
    return [self.manager updateWithItem:obj];
}

- (NSArray *)queryItemsWithClass:(Class)clz condition:(NSString *)condition, ... {
    va_list args;
    va_start(args, condition);
    NSArray *result = [self.manager queryItemsWithClass:clz condition:condition value:args];
    va_end(args);
    return result;
}

- (BOOL)deleteAllWithClass:(Class)clz {
    return [self.manager deleteAllWithClass:clz];
}


- (FMResultSet *)executeQuery:(NSString *)sql {
    return [self.manager executeQuery:sql];
}

- (BOOL)executeUpdate:(NSString *)sql {
    return [self.manager executeUpdate:sql];
}



@end
